package com.wego.domain.enums;

import com.wego.bean.base.BaseEnum;
import com.wego.utils.EnumUtil;
import lombok.Getter;

/**
 *
 * @author hc
 * @date 2025-09-06 15:45
 */
@Getter
public enum UserState implements BaseEnum {
    DISABLE(0, "封禁"),
    ENABLE(1, "正常"),
    ;

    private final Integer code;
    private final String text;

    UserState(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    /**
     * 根据code获取对应的枚举值
     * @param code 状态码
     * @return 对应的枚举值，如果未找到返回null
     */
    public static String getTextByCode(Integer code) {
        return EnumUtil.getTextByCode(UserState.class, code);
    }

    /**
     * 根据text获取对应的枚举值
     * @param text 状态文本
     * @return 对应的枚举值，如果未找到返回null
     */
    public static Integer getCodeByText(String text) {
        return EnumUtil.getCodeByText(UserState.class, text);
    }
}
